﻿<style type="text/css">
	li {list-style-type:none;}
    h3, h4, li, label {font-size: 14px;vertical-align: middle;}
    h3 {width: 96%;margin-bottom: 0px;margin-top: 10px;background: #E6E6E6;padding: 4px;}
    ul .level2 {clear: both;height: auto;overflow: hidden;}
    ul .level2 li.li2 {height: auto;overflow: hidden;display: inline-block;margin-right: 60px;}
    ul .level3 {clear: both; height: auto;overflow: hidden; margin-left: -40px;}
    ul .level3 li { display: inline-block; margin-right: 10px;}
    
.checkxuazhong:before{
    font-family: fontAwesome;
    font-weight: bold;
    font-size: 13px;
    color: #5db2ff;
    content: " ";
    background-color: #5db2ff;
    border: 1px solid #c8c8c8;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    border-radius: 0;
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    height: 18px;
    line-height: 16px;
    min-width: 18px;
    margin-right: 5px;
    margin-bottom: 2px;
    -webkit-transition: all .3s ease;
    -moz-transition: all .3s ease;
    -o-transition: all .3s ease;
    transition: all .3s ease;
}
</style>
<div class="row">
    <div class="col-xs-12 col-md-12 col-lg-12">
        <div class="widget">
            <div class="widget-header bg-blue">
            	<i class="widget-icon fa fa-arrow-left"></i>
                <span class="widget-caption">角色设置</span>
                <div class="widget-buttons">
                    <a href="#" data-toggle="maximize">
                        <i class="fa fa-expand"></i>
                    </a>
                    <a href="#" data-toggle="collapse">
                        <i class="fa fa-minus"></i>
                    </a>
                    <a href="#" data-toggle="dispose">
                        <i class="fa fa-times"></i>
                    </a>
                </div>
            </div>
            <div class="widget-body" style="height: auto;">
				
				<div class="form-title">
                    <a href="/Admin/User/role" class="btn btn-primary" data-loader="bb-loader" data-loadername="自定义菜单">
						<i class="fa fa-mail-reply"></i>返回
					</a>
                </div>
                
                <form id="bbForm" action="" method="post" class="form-horizontal"
                                                  data-bv-message=""
                                                  data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                                                  data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                                                  data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
                <input type="hidden" name="id" value="{$id}">

                <div class="access">
		            <ul>
		                <volist name="access" id="vo">	
		                    <li class="li1">
		                        <h3>
		                        	<label><input name="nid[]" type="checkbox" class="colored-blue" value="{$vo.id}" <foreach name="role" item="v" > <if condition="$v eq $vo['id']"> checked="checked" </if> </foreach> >
	                                    <span class="text">{$vo.title}</span>
									</label>
		                        </h3>
		                        
								<if condition='$vo._data'>
		                      		<ul class="level2">
		                      			<volist name="vo._data" id="b">
		                      				<li class="li2">
		                      					<h4> 
		                      						<label><input name="nid[]" type="checkbox" class="colored-blue" value="{$b.id}" <foreach name="role" item="v" > <if condition="$v eq $b['id']"> checked="checked" </if> </foreach> >
					                                    <span class="text">{$b.title}</span>
													</label>
		                      					</h4>
		                      					<if condition='$b._data'>
		                      						<ul class="level3">
			                      						<volist name="b._data" id="c">
			                      							<li class="li3">
			                      								<h5>
				                                                    <label><input name="nid[]" type="checkbox" class="colored-blue" value="{$c.id}" <foreach name="role" item="v" > <if condition="$v eq $c['id']"> checked="checked" </if> </foreach> >
									                                    <span class="text">{$c.title}</span>
																	</label>
																</h5>
			                                                </li>
			                      						</volist>
		                      						</ul>
		                      					</if>
		                      				</li>
		                      			</volist>
		                      		</ul>
		                        </if>
		                    </li>
		                </volist>
		            </ul>
		        </div>

                <br/>
               <div class="form-group">
                         <div class="col-lg-offset-1 col-lg-4">
                         <button class="btn btn-primary btn-lg" type="submit">保存</button>&nbsp;&nbsp;&nbsp;&nbsp;
                         <button class="btn btn-palegreen btn-lg" type="reset">重填</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
          
<!--面包屑导航封装-->
<div id="tmpbread" style="display: none;">{$breadhtml}</div>
<script type="text/javascript">
	setBread($('#tmpbread').html());
</script>

<!--表单验证与提交封装-->
<script type="text/javascript">
	$('#bbForm').bootstrapValidator({
		submitHandler: function (validator, form, submitButton) {
           var tourl="{:U('Admin/User/admin_role_set')}";
           var data=$('#bbForm').serialize();
           $.bb.ajax('post',tourl,data,null);
           return false;
        },
	});
	
	$('h5').find('i').remove();
		
	$(function(){
		$("input").on('click',function(){
			if($(this).is(":checked")){
				$(this).parents("li").eq(0).find("input").not($(this)).each(function (i){
					$(this).prop("checked","checked");
				})
			}else{
				$(this).parents("li").eq(0).find("input").not($(this)).each(function (i){
					$("input").removeAttr("checked");
				});
			}		
		});
	});
</script>
<!--/表单验证与提交封装-->